#ifndef USER_SERIALIZATION_H
#define USER_SERIALIZATION_H 1

#include "stm32f10x.h"
#include "user_api_types.h"
#include "user_CRC.h"
#include "board_uart.h"


void user_serialisation_api(
                               uint8_t *msg,            //input byte array pointer
                               control_pid_est_t *board,//input structure pointer
                               uint16_t max_length      //sizeof msg
                            );
void sensors_raw_data_serialisation_api
                      (
                          uint8_t *msg,//input byte array pointer for sending by TX
                          sensor_raw_data_t *board,//pointer to sensos data
                          uint16_t max_length// max length of sensor data structure
                                             // to avoid overflow.
                      );


uint8_t serialise8  (
                        uint8_t *byte_pointer,
                        uint8_t input_value,
                        uint16_t current_position,
                        uint16_t max_length
                     );

uint16_t serialise16(
                        uint8_t *byte_pointer,    // pointer to byte array
                        uint16_t input_value,     // input 16 bits value
                        uint16_t current_posution,// current position in byte array
                        uint16_t max_lenght       // size of byte array
                    );
uint16_t serialise32(
                        uint8_t *byte_pointer,
                        uint32_t input_value,
                        uint16_t current_position,
                        uint16_t max_length
                     );



#endif